﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" CodeBehind="ReportManagement.aspx.cs" Inherits="UNDP_Projects.CO.ReportManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:Label ID="error" runat="server" Visible="false"></asp:Label>
    <br />
    <% if (User.IsInRole("Administrator"))
       { %>
    <asp:Label ID="Label3" runat="server" Text="ADD NEW REPORT YEAR" CssClass="ContentHead"></asp:Label>
    <br />

    <asp:Table ID="Table1" runat="server">
        <asp:TableRow>
            <asp:TableCell style="padding-top:1em; padding-right:5px;">
                <asp:Label ID="Label1" runat="server" Text="Year"></asp:Label>
            </asp:TableCell>
            <asp:TableCell style="padding-top:1em;">
                <asp:TextBox ID="YearTX" runat="server"></asp:TextBox>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell style="padding-top:1em;"></asp:TableCell>
            <asp:TableCell style="padding-top:1em;">
                <asp:Button ID="SaveButton" runat="server" Text="Add Year" OnClick="SaveButton_Click" />
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
    <br /><br /><br />
    <% } %>

    <asp:Label ID="Label2" runat="server" Text="YEAR MANAGEMENT" CssClass="ContentHead"></asp:Label>
    <br />
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="years">
    </asp:EntityDataSource>

    <% if (User.IsInRole("Administrator"))
       { %>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource1" CssClass="NewGrid" ShowFooter="true" Width="50em" 
        DataKeyNames="year_id">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:BoundField DataField="year1" HeaderText="YEAR" SortExpression="year1" 
                ItemStyle-HorizontalAlign="Left" ItemStyle-Width="30em" />

            <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />

        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% }
       else
       { %>
        <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource1" CssClass="NewGrid" ShowFooter="true" Width="50em" 
        DataKeyNames="year_id">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:BoundField DataField="year1" HeaderText="YEAR" SortExpression="year1" 
                ItemStyle-HorizontalAlign="Left" ItemStyle-Width="30em" />
        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% } %>

    <br /><br /><br />
    <asp:Label ID="Label4" runat="server" Text="REPORT PERIOD MANAGEMENT" CssClass="ContentHead"></asp:Label>
    <br />
    <asp:EntityDataSource ID="EntityDataSource2" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="report_period">
    </asp:EntityDataSource>

    <% if (User.IsInRole("Administrator"))
       { %>
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource2" CssClass="NewGrid" ShowFooter="True" Width="50em" 
        DataKeyNames="report_period_id">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:TemplateField HeaderText="REPORT PERIOD" SortExpression="report_period1">
            <ItemStyle Width="30em" />
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Width="20em" Text='<%# Bind("report_period1") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("report_period1") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" />
            </asp:TemplateField>

            <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />

        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% }
       else
       { %>
        <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource2" CssClass="NewGrid" ShowFooter="True" Width="50em" 
        DataKeyNames="report_period_id">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:TemplateField HeaderText="REPORT PERIOD" SortExpression="report_period1">
            <ItemStyle Width="30em" />
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Width="20em" Text='<%# Bind("report_period1") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("report_period1") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" />
            </asp:TemplateField>
        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% } %>

</asp:Content>
